Skip to content

fix(memory): flatten text-part message content#5020

Open
haosenwang1018 wants to merge 1 commit intomem0ai:mainfrom
haosenwang1018:fix/flatten-text-part-message-content
Open

fix(memory): flatten text-part message content#5020
haosenwang1018 wants to merge 1 commit intomem0ai:mainfrom
haosenwang1018:fix/flatten-text-part-message-content

Conversation

@haosenwang1018
Copy link
Copy Markdown

What changed

  • In non-vision mode, flatten OpenAI-style list message content that contains text parts into plain text before extraction.
  • Preserve the existing vision path: when an LLM is provided, list content still goes through image description generation.
  • Add regression coverage for text-part arrays and the vision-enabled branch.

Fixes #3646.

Testing

  • uv run --with pytest --with pytest-mock --with ruff python -m pytest tests/memory/test_memory_utils.py -q
  • uv run --with ruff ruff check mem0/memory/utils.py tests/memory/test_memory_utils.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parse_vision_messages fails to work correctly when encountering an array content.

1 participant